package com.ruoyi.od.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.od.mapper.StockAlertSettingMapper;
import com.ruoyi.od.domain.StockAlertSetting;
import com.ruoyi.od.service.IStockAlertSettingService;
import com.ruoyi.common.core.text.Convert;

/**
 * 库存预警设置Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-06-23
 */
@Service
public class StockAlertSettingServiceImpl implements IStockAlertSettingService 
{
    @Autowired
    private StockAlertSettingMapper stockAlertSettingMapper;

    /**
     * 查询库存预警设置
     * 
     * @param settingId 库存预警设置主键
     * @return 库存预警设置
     */
    @Override
    public StockAlertSetting selectStockAlertSettingBySettingId(String settingId)
    {
        return stockAlertSettingMapper.selectStockAlertSettingBySettingId(settingId);
    }

    /**
     * 查询库存预警设置列表
     * 
     * @param stockAlertSetting 库存预警设置
     * @return 库存预警设置
     */
    @Override
    public List<StockAlertSetting> selectStockAlertSettingList(StockAlertSetting stockAlertSetting)
    {
        return stockAlertSettingMapper.selectStockAlertSettingList(stockAlertSetting);
    }

    /**
     * 新增库存预警设置
     * 
     * @param stockAlertSetting 库存预警设置
     * @return 结果
     */
    @Override
    public int insertStockAlertSetting(StockAlertSetting stockAlertSetting)
    {
        stockAlertSetting.setCreateTime(DateUtils.getNowDate());
        return stockAlertSettingMapper.insertStockAlertSetting(stockAlertSetting);
    }

    /**
     * 修改库存预警设置
     * 
     * @param stockAlertSetting 库存预警设置
     * @return 结果
     */
    @Override
    public int updateStockAlertSetting(StockAlertSetting stockAlertSetting)
    {
        stockAlertSetting.setUpdateTime(DateUtils.getNowDate());
        return stockAlertSettingMapper.updateStockAlertSetting(stockAlertSetting);
    }

    /**
     * 批量删除库存预警设置
     * 
     * @param settingIds 需要删除的库存预警设置主键
     * @return 结果
     */
    @Override
    public int deleteStockAlertSettingBySettingIds(String settingIds)
    {
        return stockAlertSettingMapper.deleteStockAlertSettingBySettingIds(Convert.toStrArray(settingIds));
    }

    /**
     * 删除库存预警设置信息
     * 
     * @param settingId 库存预警设置主键
     * @return 结果
     */
    @Override
    public int deleteStockAlertSettingBySettingId(String settingId)
    {
        return stockAlertSettingMapper.deleteStockAlertSettingBySettingId(settingId);
    }
}
